基于Web地图的交通信息分析及可视化展示平台

bamapr by 戴剑林

2017年1月10日

项目背景介绍

http://lbs.amap.com/api/webservice/summary/

http://lbsyun.baidu.com/index.php?title=webapi.

近期工作内容

批量抓取公交站点

公交站点:figure 1

## Save img as: C:\Users\DAI\AppData\Local\Temp\RtmpGKEGzC/ID_20170110141402_978.html
## 福州全市(含五区八县)共 3046 个公交车站
## 福州全市(含五区八县)共 400 个公交线路

公交路线

公交路线:figure 2

## 公交路线及其站点查询
##           ID       lat                lng stationname num direction name
## 1 BS11456360 26.023872         119.336363      白湖亭   1         1  1路
## 2 BS10889894 26.027309 119.33396900000002    迎宾路口   2         1  1路
## 3 BS10410131 26.031012 119.33031499999998  三叉街新村   3         1  1路
## 4 BS11302076 26.035707 119.32404300000002    上三路口   4         1  1路
## 5 BS10889893 26.037491 119.32255600000002    汇达广场   5         1  1路
## 6 BS11295618 26.044418 119.32155599999999        桥南   6         1  1路
## 公交路线早晚班时间
##   starttime endtime name direction
## 1     05:00   23:00  1路         1
## 2     05:00   23:00  1路        -1
## 公交路线路径地图
## Save img as: C:\Users\DAI\AppData\Local\Temp\RtmpGKEGzC/ID_20170110141405_1263.html

批量抓取路网信息

路网: figure 3

## Save img as: C:\Users\DAI\AppData\Local\Temp\RtmpGKEGzC/ID_20170110141406_1296.html

批量抓取拥堵情况

data(trafficstatus)
df=trafficstatus[!trafficstatus$expedite=="100.00%",]
tra_list=list()
for(i in 1:nrow(df)){
        a=unlist(strsplit(df$description[i],split = ";"))
        tra_list[[i]]=data.frame(road=a,
        expedite=rep(df$expedite[i],length(a)),
        congested=rep(df$congested[i],length(a)),
        blocked  =rep(df$blocked  [i],length(a)),
        unknown  =rep(df$unknown  [i],length(a)),
        stringsAsFactors = F)
}
dfx=do.call(rbind,tra_list)
dfx$expedite=gsub(pattern = "\\%",replacement = "",x = dfx$expedite)
dfx$road=unlist(strsplit(dfx$road,split = ":"))[seq(1, by = 2,length.out = nrow(dfx))]
dfx$expedite=100-as.numeric(dfx$expedite)
# cat("拥堵情况表:\n")
# head(dfx)
print(paste("路况监控时段",df$time[1],sep=""))
## [1] "路况监控时段2017-01-09 19:33:10"
wordcloud2(dfx,size = 0.3)
index=which.min(dfx$expedite)
gauge(100-dfx[index,2], min = 0, max = 100, symbol = '%', gaugeSectors(
  success = c(0, 10), warning = c(11, 89), danger = c(90, 100)
))

叠加事故标志

叠加事故标志:figure 4

## Save img as: C:\Users\DAI\AppData\Local\Temp\RtmpGKEGzC/ID_20170110141406_1375.html

叠加施工标志

叠加施工标志:figure 5

## Save img as: C:\Users\DAI\AppData\Local\Temp\RtmpGKEGzC/ID_20170110141407_1419.html

OD对期望图

OD对期望图:figure 6

## Save img as: C:\Users\DAI\AppData\Local\Temp\RtmpGKEGzC/ID_20170110141407_1480.html

应用场景

下一步工作